<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/7/19
 * Time: 16:42
 */

namespace app\ext\service;


use app\ext\model\ArticleModel;
use app\ext\model\CateModel;
use app\index\controller\Article;

class CateService extends BaseService
{
    public function cateList($f_id = 0)
    {
        $catemodel = new CateModel();
        $cate['list'] = $catemodel->cateList($f_id);

        $cate['count'] = count($cate['list']);
        foreach($cate['list'] as $key => $value)
        {
            $cate['list'][$key]['articleNum'] = $this->articleNum($value['id']);
        }

        return $cate;
    }

    public function articleNum($c_id = 0)
    {
        $articleModel = new ArticleModel();
        return $articleModel->cArticle($c_id);
    }
}